import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'
import * as packageJson from '../package.json'
/**
 * Swagger 插件
 */
export const generateDocument = app => {
  const options = new DocumentBuilder().setTitle(packageJson.name).setDescription(packageJson.description).setVersion(packageJson.version).addBearerAuth().build()
  const document = SwaggerModule.createDocument(app, options)
  SwaggerModule.setup('/api/doc', app, document)
}